package com.nfit.shopweb.mapper;

import com.nfit.shopmodel.entity.system.SysRole;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * ClassName:SysUserRoleMapper
 * Package:com.nfit.shopweb.mapper
 * Description
 *
 * @Author L
 * @Create 2024/11/19 15:58
 */
@Schema(description = "用户和角色的关联mapper接口")
@Mapper
public interface SysUserRoleMapper {
    /**
     * 根据用户id删除
     * @param userId 用户id
     */
    void deleteByUserId(Long userId);

    /**
     * 保存分配的角色
     * @param userId 用户id
     * @param roleId 角色id
     */
    void saveAssignRole(@Param("userId") Long userId,@Param("roleId") Long roleId);

    /**
     * 据用户id查询对应自身的角色数据进行数据回显
     * @param userId 用户id
     */
    List<Long> findByUserIdAssignRole(Long userId);
}
